<template>
    <div>
        <p v-for="(cate,index) in page.data" :key="index">
            <router-link :to="{path:'/goods',query:{'id':cate.id}}">{{cate.cate}}</router-link>
        </p>
        <p>
            <a @click="change(page.shang_page)">上一页</a>
            <a @click="change(num)" v-for="(num,index) in page.num_list" :key="index">{{num}}</a>
            <a @click="change(page.xia_page)">下一页</a>
        </p>
    </div>
</template>

<script>
export default {
    name:'cate',
    data(){
        return{
            page:[]
        }
    },
    created(){
        this.change(1)
    },
    methods:{
        change(num){
            this.axios.get('/cate/?page='+num).then(resp=>{
            console.log(resp.data)
            this.page=resp.data
        })
        }
    }
}
</script>

<style>

</style>